package Cafezam;

import java.util.Scanner;

public class J10Sungjuk {
	//주의 :Scanner  클래스를 이용해서 입력처리하고
	//close()를 하게되면 다시 Scanner 생성 불가
	public static void main(String[] args)
	{
		String name;
		int kor;
		int eng;
		int mat;
		int tot;
		double avg;
		char grd;
		
		
		name=inputName(makeScanner());
		kor=inputkor(makeScanner());
		eng=inputeng(makeScanner());
		mat=inputmat(makeScanner());
		
		tot=getTot(kor,eng,mat);
		avg=getavg(tot);
		grd=getgrd(avg);
		System.out.println("이름: "+name);
		System.out.println("총점: "+tot);
		System.out.println("평균: "+avg);
		System.out.println("학점: "+grd);
		
	
	}
	private static String inputName(Scanner sc) {
		String name;
		
		System.out.println("이름은?:");
		name=sc.next();
		
		return name;
	}


	private static int inputmat(Scanner sc) {
		int mat;
		
		System.out.println("수학점수:");
		mat=sc.nextInt();
		closeScanner(sc);
		return mat;
		
	
	}

	private static int inputeng(Scanner sc) {
		int eng;
	
		System.out.println("영어점수:");
		eng=sc.nextInt();
		
		return eng;
	
	}

	private static int inputkor(Scanner sc) {

		int kor;
		
		System.out.println("국어점수:");
		kor=sc.nextInt();
		
		
		return kor;
	}



//
//	private static int input[](int kor, int eng, int mat)
//	{
//		Scanner sc=new Scanner(System.in);
//		System.out.println("국어점수 입력");
//		kor=sc.nextInt();
//		System.out.println("영어점수 입력");
//		eng=sc.nextInt();
//		System.out.println("수학점수 입력");
//		mat=sc.nextInt();
//		return kor,eng mat;
//		
//	}



	private static int getTot(int kor, int eng, int mat)
	{
		return kor+eng+mat;
	}
	private static int getavg(int tot)
	{
		return tot/3;
    }
	private static char getgrd(double avg) 
	{  
		char grd;
		switch((int)avg/10)
		{
		case 10: 
		case 9: grd='수';break;
		case 8: grd='우';break;
		case 7: grd='미';break;
		case 6: grd='양';break;
		default:grd='가';
		}
		
		return grd;
	}
//Scanner 생성
	//Scanner 소멸
public static Scanner makeScanner()
{
	Scanner sc =new Scanner(System.in);
	return sc;
}
public static void closeScanner(Scanner sc)
{
	sc.close();
}

}
